package cn.yo2.irain.log4money.app.user;

import cn.yo2.irain.log4money.app.user.IUserLoginDAO;
import cn.yo2.irain.log4money.app.user.IUserLoginServices;
import cn.yo2.irain.log4money.app.user.UserLogin;

public class UserLoginServicesImpl implements IUserLoginServices {

    private IUserLoginDAO userLoginDAO;

    public UserLogin getByLoginName(String loginName) throws RuntimeException {
        return userLoginDAO.getByLoginName(loginName);
    }

    public UserLogin checkUserName(String loginName) throws RuntimeException {
        return userLoginDAO.findUserLoginByLoginName(loginName);
    }

    public boolean checkUserLogin(String userName, String password) throws RuntimeException {
        return userLoginDAO.findUserLoginByNameAndPwd(userName, password);
    }

    public void saveUserLogin(UserLogin userLogin) throws RuntimeException {
        userLoginDAO.saveUserLogin(userLogin);
    }

    public void setUserLoginDAO(IUserLoginDAO userLoginDAO) {
        this.userLoginDAO = userLoginDAO;
    }

    public void updateUserLogin(UserLogin userLogin) throws RuntimeException {
        this.userLoginDAO.updateUserLogin(userLogin);
    }

    public UserLogin findById(String id) {
        return userLoginDAO.findUserLoginById(id);
    }
}
